org.eclipse.vtp.desktop.projects.core.internals
Class BusinessObject

java.lang.Object
  extended by org.eclipse.vtp.desktop.projects.core.internals.VoiceResource
      extended by org.eclipse.vtp.desktop.projects.core.internals.BusinessObject
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IBusinessObject, ObjectListener, IVoiceToolsResource

public class BusinessObject
extends VoiceResource
implements IBusinessObject

This is a concrete implementation of IBusinessObject and provides the default behavior of that interface.

Version:
2.0
Author:
Trip Gilman

Constructor Summary
BusinessObject(BusinessObjectSet objectSet, org.eclipse.core.resources.IFile file)
          Creates a new BusinessObject with the given parent business object set and eclipse file resource.
 
Method Summary
 void delete()
           
 IBusinessObjectSet getBusinessObjectSet()
           
 java.util.List getFields()
           
 java.lang.String getId()
           
 java.lang.String getName()
           
protected  java.lang.String getObjectId()
          The object id is used by the event system to uniquely identify a project resource.
 IVoiceToolsResource getParent()
          Returns the parent of this resource.
 org.eclipse.core.resources.IFile getUnderlyingFile()
           
 void processObjectEvent(ObjectEvent event)
          Called when an event is generated by the object being listened to.
 java.io.InputStream read()
          Opens the underlying eclipse file resource that contains the XML format definition of this business object.
 void write(java.io.InputStream source)
          Requests the contents of the XML format definition of this business object definition be replaced with the data from the given input stream.
 
Methods inherited from class org.eclipse.vtp.desktop.projects.core.internals.VoiceResource
addRefreshListener, deferEvents, finalize, getAdapter, getProject, refresh, removeRefreshListener, resumeEvents
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.vtp.desktop.projects.core.IVoiceToolsResource
addRefreshListener, deferEvents, getProject, refresh, removeRefreshListener, resumeEvents
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

BusinessObject

public BusinessObject(BusinessObjectSet objectSet,
                      org.eclipse.core.resources.IFile file)
Creates a new BusinessObject with the given parent business object set and eclipse file resource.

Parameters:
objectSet - The parent business object set
file - The eclipse file resource that contains this business object type's definition
Method Detail

getObjectId

protected java.lang.String getObjectId()
Description copied from class: VoiceResource
The object id is used by the event system to uniquely identify a project resource. In this fashion, multiple references to the resource can be created and still be notified of events.

Specified by:
getObjectId in class VoiceResource
Returns:
A unique identifier for this resource

getId

public java.lang.String getId()
Specified by:
getId in interface IBusinessObject
Returns:
The unique identifier for this business object definition

getName

public java.lang.String getName()
Specified by:
getName in interface IVoiceToolsResource
Returns:
The name of the resource

getFields

public java.util.List getFields()
Specified by:
getFields in interface IBusinessObject
Returns:
A list of IBusinessObjectFields that define the names and data types of the business object's fields

getParent

public IVoiceToolsResource getParent()
Description copied from interface: IVoiceToolsResource
Returns the parent of this resource. If this is a project resource this function returns this.

Specified by:
getParent in interface IVoiceToolsResource
Returns:
The parent of this resource resource

read

public java.io.InputStream read()
                         throws org.eclipse.core.runtime.CoreException
Opens the underlying eclipse file resource that contains the XML format definition of this business object. The contents are return in an InputStream.

Returns:
An input stream containing the contents of the XML format definition of this business object tyep
Throws:
org.eclipse.core.runtime.CoreException - If an error occured while opening the file resource

processObjectEvent

public void processObjectEvent(ObjectEvent event)
Description copied from interface: ObjectListener
Called when an event is generated by the object being listened to.

Specified by:
processObjectEvent in interface ObjectListener
Overrides:
processObjectEvent in class VoiceResource
Parameters:
event - The event that occured

write

public void write(java.io.InputStream source)
           throws org.eclipse.core.runtime.CoreException
Requests the contents of the XML format definition of this business object definition be replaced with the data from the given input stream.

Parameters:
source - An input stream to the new file contents
Throws:
org.eclipse.core.runtime.CoreException - If an error occured while writing the new contents of the file

getBusinessObjectSet

public IBusinessObjectSet getBusinessObjectSet()
Specified by:
getBusinessObjectSet in interface IBusinessObject
Returns:
The parent folder resource of this business object definition

delete

public void delete()
            throws org.eclipse.core.runtime.CoreException
Specified by:
delete in interface IBusinessObject
Throws:
org.eclipse.core.runtime.CoreException

getUnderlyingFile

public org.eclipse.core.resources.IFile getUnderlyingFile()
Specified by:
getUnderlyingFile in interface IBusinessObject